<template>
	<view class="container-page">
		<!-- <u-swipe-action v-if="actions" class="main">
			<u-swipe-action-item v-for="(item, index) in actions" :key="index" :show="item.show" :index="index">
				<view class="p32" style="display: flex;" @click="goUrl(item.url)">
					<view class="t32 c-content" style="flex: 1;align-self: center;">
						<view class="t32 c-primary tbold">{{item.name}}</view>
						<view class="t28 c-content">{{item.desc}}</view>
					</view>
					<view class="p16" style="align-self: center;">
						<u-image :src="item.pic" mode="aspectFill" radius="16rpx" width="180rpx"
							height="180rpx"></u-image>
					</view>
					<view class="p16" style="align-self: center;">
						<u-icon name="checkmark-circle-fill" :color="item.checked?'#f00':'#ccc'" size="40rpx"></u-icon>
					</view>
				</view>
			</u-swipe-action-item>
		</u-swipe-action> -->
		<view class="main">
			<view>
				<view class="p32" style="display: flex;" @click="goUrl('/pages/order/valueadd-wooden')">
					<view class="t32 c-content" style="flex: 1;align-self: center;">
						<view class="t32 c-primary tbold">{{this.form.wooden.name}}</view>
						<view class="t28 c-content">为您提供打木架服务，保护您的商品避免损坏</view>
					</view>
					<view class="p16" style="align-self: center;">
						<u-image src="/static/images/ic_box1.png" mode="aspectFill" radius="16rpx" width="180rpx"
							height="180rpx"></u-image>
					</view>
					<view class="p16" style="align-self: center;">
						<u-icon name="checkmark-circle-fill" :color="this.form.wooden.value?'#f00':'#ccc'" size="40rpx"></u-icon>
					</view>
				</view>
			</view>
			<view>
				<view class="p32" style="display: flex;" @click="goUrl('/pages/order/valueadd-carton')">
					<view class="t32 c-content" style="flex: 1;align-self: center;">
						<view class="t32 c-primary tbold">{{this.form.carton.name}}</view>
						<view class="t28 c-content">为您提供打木架服务，保护您的商品避免损坏</view>
					</view>
					<view class="p16" style="align-self: center;">
						<u-image src="/static/images/ic_box2.png" mode="aspectFill" radius="16rpx" width="180rpx"
							height="180rpx"></u-image>
					</view>
					<view class="p16" style="align-self: center;">
						<u-icon name="checkmark-circle-fill" :color="this.form.carton.value?'#f00':'#ccc'" size="40rpx"></u-icon>
					</view>
				</view>
			</view>
		</view>
		<view class="bottom">
			<u-button type="success" shape="circle" @click="submit">确定</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				options: [{
					text: '删除',
					style: {
						backgroundColor: '#dd524d'
					}
				}],
				form: {
					wooden: {
						name: "木质包装",
						value: undefined,
					},
					carton: {
						name: "包装服务",
						value: undefined,
					},
				},
			}
		},
		created() {

		},
		mounted() {

		},
		onReady() {
			uni.$on('carry_valueadd_wooden', (bean) => {
				this.form.wooden.value=bean
			})
			uni.$on('carry_valueadd_carton', (bean) => {
				this.form.carton.value=bean
			})
		},
		onLoad(e) {
			var bean=uni.getStorageSync('carry_valueadd')
			if(bean)this.form=bean;
		},
		onShow() {

		},
		methods: {
			submit() {
				uni.$emit('carry_valueadd', this.form)
				uni.setStorageSync('carry_valueadd', this.form);
				uni.navigateBack();
			},
			goUrl(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>
<style scoped lang="scss">
	.container-page {
		width: 100vw;
		height: calc(100vh - var(--window-bottom) - var(--status-bar-height) - var(--window-top));
		overflow: hidden;
		display: flex;
		flex-direction: column;

		.main {
			flex: 1;
			overflow: hidden;

		}

		.bottom {
			padding: 32rpx 32rpx;

		}
	}
</style>